package com.allianz.webapps.controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.allianz.webapps.https.interfaces.appOffline.AppOffline;
import com.allianz.webapps.https.interfaces.type001.pojo.User;
import com.allianz.webapps.orderspojo.AppBase;
import com.fasterxml.jackson.databind.ObjectMapper;

//http://localhost:8080/pad_marketing/main/appOffline.action  

@Controller
@RequestMapping(value="main")
public class AppOfflineController {

	@Autowired
	private ObjectMapper objectMapper;
	@Autowired
	private AppOffline appOffline;
	
	/**
	 * 转线下
	 */
	@RequestMapping(value="appOffline")
	@ResponseBody
	public String appOffline(@RequestParam(value="jsonParam") String jsonParam,HttpServletRequest request,HttpServletResponse response)
			throws Exception{
		AppBase appBase=(AppBase)objectMapper.readValue(jsonParam, AppBase.class);
		User user=(User)request.getSession().getAttribute("username");
		appBase.setUser(user);
		String body=appOffline.requestOfflineParam(appBase);
		return body;
	}

	
}
